﻿namespace Agile.Service.Admin.WebApi.Controllers;

/// <summary>
/// 系统岗位服务接口
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class SysPositionController : AgileControllerBase
{
    /// <summary> 添加岗位 </summary> 
    [HttpPost]
    public async Task<ResponseResult<bool>> Insert(InsertSysPositionRequest request)
    => Result(await this.GetService<ISysPositionService>().InsertAsync(request));

    /// <summary> 修改岗位 </summary> 
    [HttpPost]
    public async Task<ResponseResult<bool>> Update(UpdateSysPositionRequest request)
    => Result(await this.GetService<ISysPositionService>().UpdateAsync(request));

    /// <summary> 禁用/启用 </summary> 
    [HttpGet]
    public async Task<ResponseResult<bool>> Enabled(long positionID, bool enabled)
    => Result(await this.GetService<ISysPositionService>().EnabledAsync(positionID, enabled));

    /// <summary> 删除岗位 </summary> 
    [HttpGet]
    public async Task<ResponseResult<bool>> Remove(long positionID)
    => Result(await this.GetService<ISysPositionService>().RemoveAsync(positionID));
     
    /// <summary> 查询岗位 </summary> 
    [HttpPost]
    public async Task<ResponseResult<List<QuerySysPositionResponse>>> Query(QuerySysPositionRequest request)
    => Result(await this.GetService<ISysPositionService>().QueryAsync(request));
}
